%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, fleqn]{article}
\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{graphicx}
\usepackage{lastpage}
\usepackage{multicol}

% DOCUMENT LAYOUT
\usepackage{geometry} 
\geometry{letterpaper, textwidth=6.5in, textheight=9in}
\setlength{\parindent}{0in}

% SECTION HEADINGS
\usepackage{sectsty}
\sectionfont{\mdseries}

% ITEM ENVIRONMENT
\newenvironment{baseenumerate}
  {\begin{enumerate}[leftmargin=0pt]
	\setlength{\baselineskip}{0pt}
	\setlength{\itemsep}{0pt}
	\setlength{\parskip}{10pt}}
  {\end{enumerate}}
	
\newenvironment{myenumerate}
  {\begin{enumerate}[leftmargin=*]
	\setlength{\baselineskip}{0pt}
    \setlength{\itemsep}{0pt}
	\setlength{\parskip}{10pt}}
  {\end{enumerate}}

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{(\alph{enumii})}
\renewcommand{\labelenumiii}{\roman{enumiii}.}

% PAGE NUMBERS
\usepackage{fancyhdr}
\pagestyle{fancy}
\cfoot{}
\rfoot{\textbf{\thepage} / \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

% DOCUMENT
\begin{document}

\begin{multicols}{2}
  \textbf{Assignment 6.}
  \columnbreak
  
  \begin{flushright}
	Benedict Yip \\
	May 14, 2011 \\
	CS 378
  \end{flushright}
\end{multicols}

\begin{flushleft}
  
  \begin{baseenumerate}

  \item % 1.
  
  \textbf{Matrix-Matrix Multiply Runtime}
  
  \begin{tabular}{| l | l | l | l |}
    \hline
    \textbf{n} & \textbf{CPU} (s) & \textbf{GPU} (s) & \textbf{Speedup} \\ \hline
    1024       & 8.95             & 0.12             & 74x              \\ \hline
    2048       & 80.82            & 0.78             & 103x             \\ \hline
    4096       & 757.46           & 1.99             & 380x             \\
    \hline
  \end{tabular}
  
  \textbf{CUDA MMM Speedup Over CPU MMM for Various n}
  \includegraphics[scale=0.75]{1.pdf}
    
  These results are consistent with our understanding of CUDA MMM. As the CPU
  MMM code exhibits $O(n^3)$ execution time, the massively parallel GPU exhibits
  only linear runtime increases as n increases.
  
  \pagebreak
  
  \item % 2.
  
  \textbf{N-body Runtime}
  
  \begin{tabular}{| l | l | l | l |}
    \hline
    \textbf{n} & \textbf{CPU} (s) & \textbf{GPU} (s) & \textbf{Speedup} \\ \hline
    4096       & 2.28             & 0.57             & 4x               \\ \hline
    8192       & 9.04             & 3.19             & 2.8x             \\ \hline
    16384      & 32.92            & 8.53             & 3.9x             \\
    \hline
  \end{tabular}
  
  \textbf{CUDA N-body Speedup Over CPU MMM for Various n}
  \includegraphics[scale=0.75]{2.pdf}
  
  These results show less improvement for CUDA N-body simulation in comparison
  to CPU N-body simulation, but this is to be expected as N-body simulation only
  exhibits $O(n^2)$ complexity, however are seemingly consistent with themselves.
  
  \end{baseenumerate}
\end{flushleft}

\end{document}
